// pages/new_inter/hotel_citys/hotel_citys.js
const app = getApp();

Page({

  /**
   * 页面的初始数据
   */

  data: {
    imgUrls: ["0","0"
    ],
    indicatorDots: true,
    vertical: false,
    autoplay: true,
    interval: 3000,
    duration: 300,
    cityZu: [{
        cityImg: 'https://images.unsplash.com/photo-1551334787-21e6bd3ab135?w=640',
        bt: '昆明',
        jieshao: '是水水水水飒飒大大大大撒多阿萨德阿撒打算的撒多啊'
      },
      {
        cityImg: 'https://images.unsplash.com/photo-1551214012-84f95e060dee?w=640',
        bt: '昆明',
        jieshao: '是水水水水飒飒大大大大撒多阿萨德阿撒打算的撒多啊'
      },
      {
        cityImg: 'https://images.unsplash.com/photo-1551446591-142875a901a1?w=640',
        bt: '昆明',
        jieshao: '是水水水水飒飒大大大大撒多阿萨德阿撒哒哒哒哒哒哒阿打发啊啊打算的撒多啊'
      }, 
      {
        cityImg: 'https://images.unsplash.com/photo-1551446591-142875a901a1?w=640',
        bt: '昆明',
        jieshao: '是水水水水飒飒大大大大撒多阿萨德阿撒打算的撒多啊'
      }
    ],
    info: [{
      img: '../../images/6.jpg',
      title: '三亚'
    }, {
      img: '../../images/6.jpg',
      title: '三亚'
    }, {
      img: '../../images/6.jpg',
      title: '三亚'
    }, {
      img: '../../images/6.jpg',
      title: '三亚'
    }],
    hostUrl: app.globalData.hostUrl,
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.setData({
      foot:wx.getStorageSync('foot'),
      is_show:wx.getStorageSync('is_show')

    })
    this.hotel_city();
  },
  hotel_city:function(){
    var that=this;
    wx.request({
      url: app.globalData.apiUrl + 'Hotel/citys',
      data: {
        // opt: 'getBanner',
        typeId: '',
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        // console.log(res)
        if (res.data != null) {

          var adv = res.data.adv[0];
          for (var i = 0, len = adv.length; i < len; ++i) {
            var desc = that.delHtmlTag(res.data.adv[0][i].desc)
            res.data.adv[0][i].desc = desc;
          }
          that.setData({
            info: res.data,
          })
          console.log(that.data.info, '过滤后')
        }
      }
    })
  },
  delHtmlTag: function (msg) {
    var msg = msg.replace(/<\/?[^>]*>/g, ''); //去除HTML Tag
    msg = msg.replace(/[|]*\n/, '') //去除行尾空格
    msg = msg.replace(/&nbsp;/ig, ''); //去掉npsp
    return msg;
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  },
  index: function () {
    wx.reLaunch({
      url: '/pages/index/index'
    })
  },
  dichan: function () {
    wx.reLaunch({
      url: '/pages/dichan/dichan'
    })
  },
  jiankang: function () {
    wx.navigateTo({
      url: '/pages/jiankang/jiankang'
    });
  },
  news: function () {
    wx.navigateTo({
      url: '/pages/news/news'
    });
  },
})